package com.elinshaw.pattern.future;

/**
 * @author Administrator
 */
public interface FutureService<IN, OUT> {

    /**
     * 提交不需要返回值的任务
     *
     * @param runnable
     * @return
     */
    Future<?> submit(Runnable runnable);

    Future<OUT> submit(Task<IN, OUT> task, IN input);

    /**
     * 支持回调
     *
     * @param task
     * @param input
     * @param callback
     * @return
     */
    Future<OUT> submit(Task<IN, OUT> task, IN input, Callback<OUT> callback);

    static <T, R> FutureService<T, R> newService() {
        return new FutureServiceImpl();
    }


}
